using System;
using UnityEngine;

[Serializable]
public class buyevent : MonoBehaviour
{
	public string lt;

	public string @event;

	public int cost;

	public AudioClip clip;

	public Color pressed;

	public Color unpressed;

	public GameObject buyobj;

	public Collider yes;

	public Camera mainCamera;

	public buyevent()
	{
		lt = string.Empty;
		@event = string.Empty;
	}

	public void Update()
	{
		if (Input.GetMouseButtonUp(0))
		{
			st();
		}
		if (!Input.GetMouseButtonDown(0))
		{
			return;
		}
		RaycastHit hitInfo = default(RaycastHit);
		if (Physics.Raycast(mainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition), out hitInfo, 100f) && hitInfo.collider.name == "Yes")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			yes.GetComponent<Renderer>().material.color = pressed;
			yes.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			if (PlayerPrefs.GetInt("Exp") > 1199 && PlayerPrefs.GetInt(lt) == 1)
			{
				PlayerPrefs.SetInt(@event, 1);
				PlayerPrefs.SetInt("Exp", PlayerPrefs.GetInt("Exp") - cost);
				MonoBehaviour.print("bought");
				UnityEngine.Object.Destroy(buyobj);
			}
		}
	}

	public void st()
	{
		yes.GetComponent<Renderer>().material.color = unpressed;
		yes.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
	}

	public void Main()
	{
	}
}
